import request from "@/api/config";
import { AxiosPromise } from 'axios';
import {PORT} from "@/leadmall/api/config/servicePort";
import { ScheduleVO, ScheduleForm, ScheduleQuery } from '@/leadmall/api/schedule/types';

/**
 * 查询工作记录列表
 * @param query
 * @returns {*}
 */

export const listSchedule = (query?: ScheduleQuery): AxiosPromise<ScheduleVO[]> => {
  return request({
    url: PORT +'/leadmall/schedule/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询工作记录详细
 * @param id
 */
export const getSchedule = (id: string | number): AxiosPromise<ScheduleVO> => {
  return request({
    url: PORT +'/leadmall/schedule/' + id,
    method: 'get'
  });
};

/**
 * 新增工作记录
 * @param data
 */
export const addSchedule = (data: ScheduleForm) => {
  return request({
    url: PORT +'/leadmall/schedule',
    method: 'post',
    data: data
  });
};

/**
 * 修改工作记录
 * @param data
 */
export const updateSchedule = (data: ScheduleForm) => {
  return request({
    url: PORT +'/leadmall/schedule',
    method: 'put',
    data: data
  });
};

/**
 * 删除工作记录
 * @param id
 */
export const delSchedule = (id: string | number | Array<string | number>) => {
  return request({
    url: PORT +'/leadmall/schedule/' + id,
    method: 'delete'
  });
};
